// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.designer.ui.query;

import org.dengues.commons.IDenguesSharedImage;
import org.dengues.commons.utils.ImageUtil;
import org.dengues.designer.ui.i18n.Messages;
import org.dengues.designer.ui.query.sections.GroupsSection;
import org.dengues.designer.ui.query.sections.SortsSection;
import org.dengues.designer.ui.query.sections.TableColumnsSection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf Qiang.Zhang.Adolf@gmail.com 2008-1-21 qiang.zhang $
 * 
 */
public class GroupSortFormPage extends AbstractFormPage {

    /**
     * Qiang.Zhang.Adolf@gmail.com GroupSortFormPage constructor comment.
     * 
     * @param editor
     */
    public GroupSortFormPage(FormEditor editor) {
        super(editor, ID_GROUP_SOERT, Messages.getString("GroupSortFormPage.name")); //$NON-NLS-1$
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
     */
    @Override
    protected void createFormContent(IManagedForm managedForm) {
        super.createFormContent(managedForm);
        ScrolledForm form = managedForm.getForm();
        form.setImage(ImageUtil.getImage(IDenguesSharedImage.QUERSTION));
        form.setText(Messages.getString("GroupSortFormPage.name")); //$NON-NLS-1$
        Composite body = form.getBody();
        body.setLayout(createFormGridLayout(true, 2));

        Composite left, right;
        FormToolkit toolkit = managedForm.getToolkit();
        left = toolkit.createComposite(body, SWT.NONE);
        left.setLayout(createFormPaneGridLayout(false, 1));
        left.setLayoutData(new GridData(GridData.FILL_BOTH));
        right = toolkit.createComposite(body, SWT.NONE);
        right.setLayout(createFormPaneGridLayout(false, 1));
        right.setLayoutData(new GridData(GridData.FILL_BOTH));

        managedForm.addPart(new TableColumnsSection(this, left));
        managedForm.addPart(new GroupsSection(this, right));
        managedForm.addPart(new SortsSection(this, right));
    }

}
